---
title: Slug field
summary: >-
  The slug field auto-generates a URL-friendly string alongside another text
  string.
---
{% field-demo field="slug" /%}

The `slug` field auto-generates a URL-friendly string alongside another text string.

Typically used in scenarios where you'd want a `text` field to define the slug of an entry — think of a post `title` or an author `name`. You set that field to a `slug` field instead. It will store the `text` string you need, while also generating a `slug` for you.

You will be presented with two input fields in the Admin UI. You can manually override that `slug` value, and have control over the labels for both fields.

## Usage example

```typescript
title: fields.slug({
  name: {
    label: 'Title',
    description: 'The title of the post',
  },
  // Optional slug label overrides
  slug: {
    label: 'SEO-friendly slug',
    description: 'This will define the file/folder name for this entry'
  }
})
```

{% aside icon="📢" %}
The following components have a `slugField` option:

- [Collection](/docs/collections-and-singletons#slug-field) (use in conjunction with the `slug` field)
- [Array field](/docs/fields/array#slug-field)
{% /aside %}

## Type signature

Find the latest version of this field's type signature at: [https://docsmill.dev/npm/@keystatic/core@latest#/.fields.slug](https://docsmill.dev/npm/@keystatic/core@latest#/.fields.slug)
